|
adc28 2.2.0
|
API for configuring and manipulating ADC 28 Click driver. More...
Topics | |
| ADC 28 Registers List | |
| List of registers of ADC 28 Click driver. | |
| ADC 28 Registers Settings | |
| Settings for registers of ADC 28 Click driver. | |
| ADC 28 MikroBUS Map | |
| MikroBUS pin mapping of ADC 28 Click driver. | |
Functions | |
| void | adc28_cfg_setup (adc28_cfg_t *cfg) |
| ADC 28 configuration object setup function. | |
| err_t | adc28_init (adc28_t *ctx, adc28_cfg_t *cfg) |
| ADC 28 initialization function. | |
| err_t | adc28_default_cfg (adc28_t *ctx) |
| ADC 28 default configuration function. | |
| err_t | adc28_write_reg (adc28_t *ctx, uint8_t reg, uint8_t data_in) |
| ADC 28 write register function. | |
| err_t | adc28_write_regs (adc28_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len) |
| ADC 28 write registers function. | |
| err_t | adc28_read_reg (adc28_t *ctx, uint8_t reg, uint8_t *data_out) |
| ADC 28 read register function. | |
| err_t | adc28_read_regs (adc28_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len) |
| ADC 28 read registers function. | |
| uint8_t | adc28_get_alert_pin (adc28_t *ctx) |
| ADC 28 get alert pin function. | |
| err_t | adc28_set_high_threshold (adc28_t *ctx, uint8_t channel, uint16_t high_th) |
| ADC 28 set high threshold function. | |
| err_t | adc28_set_low_threshold (adc28_t *ctx, uint8_t channel, uint16_t low_th) |
| ADC 28 set low threshold function. | |
| err_t | adc28_set_hysteresis (adc28_t *ctx, uint8_t channel, uint8_t hysteresis) |
| ADC 28 set hysteresis function. | |
| err_t | adc28_set_event_count (adc28_t *ctx, uint8_t channel, uint8_t event_count) |
| ADC 28 set event count function. | |
| err_t | adc28_read_raw_adc (adc28_t *ctx, uint8_t channel, uint16_t *raw_data) |
| ADC 28 read raw ADC function. | |
| err_t | adc28_read_voltage (adc28_t *ctx, uint8_t channel, float *voltage) |
| ADC 28 read voltage function. | |
API for configuring and manipulating ADC 28 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
| void adc28_cfg_setup | ( | adc28_cfg_t * | cfg | ) |
ADC 28 configuration object setup function.
This function initializes Click configuration structure to initial values.
| [out] | cfg | : Click configuration structure. See adc28_cfg_t object definition for detailed explanation. |
| err_t adc28_default_cfg | ( | adc28_t * | ctx | ) |
ADC 28 default configuration function.
This function executes a default configuration of ADC 28 Click board.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | uint8_t adc28_get_alert_pin | ( | adc28_t * | ctx | ) |
ADC 28 get alert pin function.
This function returns the logic state of the ALT (ALERT) pin.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| err_t adc28_init | ( | adc28_t * | ctx, |
| adc28_cfg_t * | cfg ) |
ADC 28 initialization function.
This function initializes all necessary pins and peripherals used for this Click board.
| [out] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | cfg | : Click configuration structure. See adc28_cfg_t object definition for detailed explanation. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_read_raw_adc | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| uint16_t * | raw_data ) |
ADC 28 read raw ADC function.
This function reads the RAW ADC measurement.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [out] | raw_data | : Pointer to the raw ADC result [0, 4095]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_read_reg | ( | adc28_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out ) |
ADC 28 read register function.
This function reads a single byte of data from the selected register.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [out] | data_out | : Pointer to the output data. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_read_regs | ( | adc28_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_out, | ||
| uint8_t | len ) |
ADC 28 read registers function.
This function reads a sequential block of data starting from the selected register.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [out] | data_out | : Pointer to the output data buffer. |
| [in] | len | : Number of bytes to be read. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_read_voltage | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| float * | voltage ) |
ADC 28 read voltage function.
This function reads the ADC result from the selected channel and converts it to a voltage level.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [out] | voltage | : Pointer to the output voltage. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_set_event_count | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| uint8_t | event_count ) |
ADC 28 set event count function.
This function sets the number of consecutive threshold crossings required before the ALERT flag is set for the selected channel. ALERT triggers after event_count + 1 crossings.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [in] | event_count | : Event count value [0, 15]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_set_high_threshold | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| uint16_t | high_th ) |
ADC 28 set high threshold function.
This function sets the high threshold for the selected channel.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [in] | high_th | : High threshold 12-bit raw ADC value [0, 4095]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_set_hysteresis | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| uint8_t | hysteresis ) |
ADC 28 set hysteresis function.
This function sets the hysteresis for the selected channel. The actual hysteresis applied by the device is the written value multiplied by 8 LSBs.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [in] | hysteresis | : Hysteresis value [0, 15]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_set_low_threshold | ( | adc28_t * | ctx, |
| uint8_t | channel, | ||
| uint16_t | low_th ) |
ADC 28 set low threshold function.
This function sets the low threshold for the selected channel.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | channel | : Channel selection. |
| [in] | low_th | : Low threshold 12-bit raw ADC value [0, 4095]. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_write_reg | ( | adc28_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t | data_in ) |
ADC 28 write register function.
This function writes a desired data word to the selected register by using I2C serial interface.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | reg | : Register address. |
| [in] | data_in | : Data word to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation. | err_t adc28_write_regs | ( | adc28_t * | ctx, |
| uint8_t | reg, | ||
| uint8_t * | data_in, | ||
| uint8_t | len ) |
ADC 28 write registers function.
This function writes a sequential block of data starting from the selected register.
| [in] | ctx | : Click context object. See adc28_t object definition for detailed explanation. |
| [in] | reg | : Start register address. |
| [in] | data_in | : Pointer to the input data buffer. |
| [in] | len | : Number of bytes to be written. |
0 - Success, -1 - Error. See #err_t definition for detailed explanation.